﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using MarsExplorerWebSite.Model;

namespace MarsExplorerWebSite.Functions
{
    public class getTurn : FunctionBase
    {
        private MarsExplorerEntities dbContext;
        public int TurnId { get; set; }

        public getTurn(HttpContext context)
            : base(context)
        {
            InitializeProperties();
        }

        public override string Execute()
        {


            Game g = (from x in dbContext.Games where x.GameID == 1 select x).FirstOrDefault();
            return g.RunningTurn.ToString();
          
        }

        public override void InitializeProperties()
        {
            try
            {
               
                dbContext = new MarsExplorerEntities();
            }
            catch (Exception e)
            {
                string message = "";
                #if DEBUG
                message += " : " + e.ToString();
                #endif
            }
        }
    }
}